package net.homeip.jcperera.nu.people.person;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import net.homeip.jcperera.nu.model.entity.PersistentEntity;

@Entity
@Table(name = Person.tableName)
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorValue(value = Person.tableName)
public class Person extends PersistentEntity implements Serializable
{
    // Required to implement Serializable interface
    private static final long  serialVersionUID = 4441187674983603912L;

    // CoreBase properties, for easy use from other components, as well as logging
    public static final int    runtimeLevel     = 2;
    public static final String moduleName       = "people";
    public static final String componentName    = "nu_people_person";

    // All persistent entities should specify a table name
    public static final String tableName        = "PERSON";

    @Basic
    @Column(name = "PERSON_ID", unique = true)
    private String             personID;

    @Basic
    @Column(name = "FIRST_NAME")
    private String             firstName;

    @Basic
    @Column(name = "MIDDLE_INITIAL", length = 1)
    private String             middleInitial;

    @Basic
    @Column(name = "LAST_NAME")
    private String             lastName;

    @Basic
    @Column(name = "SURNAME")
    private String             surName;

    @Basic
    @Column(name = "OTHER_SURNAME")
    private String             otherSurName;

    @Basic
    @Enumerated(EnumType.STRING)
    @Column(name = "GENDER")
    private Gender gender = Gender.MALE;

    public Person()
    {
    }

    public String getPersonID()
    {
        return personID;
    }

    public void setPersonID(String personID)
    {
        this.personID = personID;
    }

    public String getFirstName()
    {
        return firstName;
    }

    public void setFirstName(String firstName)
    {
        this.firstName = firstName;
    }

    public String getMiddleInitial()
    {
        return middleInitial;
    }

    public void setMiddleInitial(String middleInitial)
    {
        this.middleInitial = middleInitial;
    }

    public String getLastName()
    {
        return lastName;
    }

    public void setLastName(String lastName)
    {
        this.lastName = lastName;
    }

    public String getSurName()
    {
        return surName;
    }

    public void setSurName(String surName)
    {
        this.surName = surName;
    }

    public String getOtherSurName()
    {
        return otherSurName;
    }

    public void setOtherSurName(String otherSurName)
    {
        this.otherSurName = otherSurName;
    }

    public Gender getGender()
    {
        return gender;
    }

    public void setGender(Gender gender)
    {
        this.gender = gender;
    }
}
